package com.situ.mall.web.controller;

import com.situ.mall.common.service.IOrderInfoService;
import com.situ.mall.common.vo.TableVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/")
public class PersonalController {

    @Autowired
    private IOrderInfoService orderInfoService;

    @GetMapping("/personal")
    public String personal(Model model) {
        model.addAttribute("menu", "profile");
        return "profile";
    }

    @GetMapping("/personal/order")
    public String page(Model model) {
        model.addAttribute("menu", "order");
        return "order";
    }

    @GetMapping("/personal/address")
    public String page2(Model model){
        model.addAttribute("menu","address");
        return "address";
    }

    @GetMapping("/personal/orderList")
    @ResponseBody
    public TableVO orderList(Integer page, Integer limit, String status, String keyword) {
        return orderInfoService.orderList(page, limit, status, keyword);
    }
}
